package com.ktgj.service.controller;

import java.util.List;
import java.io.IOException;
import javax.servlet.http.HttpServletResponse;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import com.ktgj.common.log.annotation.Log;
import com.ktgj.common.log.enums.BusinessType;
import com.ktgj.common.security.annotation.PreAuthorize;
import com.ktgj.service.domain.ViphallCommentReply;
import com.ktgj.service.service.IViphallCommentReplyService;
import com.ktgj.common.core.web.controller.BaseController;
import com.ktgj.common.core.web.domain.AjaxResult;
import com.ktgj.common.core.utils.poi.ExcelUtil;
import com.ktgj.common.core.web.page.TableDataInfo;

/**
 * 贵宾厅评论回复Controller
 * 
 * @author ruoyi
 * @date 2021-11-22
 */
@ControllerAdvice
@RestController
@RequestMapping("/commentReply")
public class ViphallCommentReplyController extends BaseController
{
    @Autowired
    private IViphallCommentReplyService viphallCommentReplyService;

    /**
     * 查询贵宾厅评论回复列表
     */
    @PreAuthorize(hasPermi = "service:reply:list")
    @GetMapping("/list")
    public TableDataInfo list(ViphallCommentReply viphallCommentReply)
    {
        startPage();
        List<ViphallCommentReply> list = viphallCommentReplyService.selectViphallCommentReplyList(viphallCommentReply);
        return getDataTable(list);
    }

    /**
     * 导出贵宾厅评论回复列表
     */
    @PreAuthorize(hasPermi = "service:reply:export")
    @Log(title = "贵宾厅评论回复", businessType = BusinessType.EXPORT)
    @PostMapping("/export")
    public void export(HttpServletResponse response, ViphallCommentReply viphallCommentReply) throws IOException
    {
        List<ViphallCommentReply> list = viphallCommentReplyService.selectViphallCommentReplyList(viphallCommentReply);
        ExcelUtil<ViphallCommentReply> util = new ExcelUtil<ViphallCommentReply>(ViphallCommentReply.class);
        util.exportExcel(response, list, "贵宾厅评论回复数据");
    }

    /**
     * 获取贵宾厅评论回复详细信息
     */
    @PreAuthorize(hasPermi = "service:reply:query")
    @GetMapping(value = "/{commentReplyId}")
    public AjaxResult getInfo(@PathVariable("commentReplyId") Long commentReplyId)
    {
        return AjaxResult.success(viphallCommentReplyService.selectViphallCommentReplyById(commentReplyId));
    }

    /**
     * 新增贵宾厅评论回复
     */
    @PreAuthorize(hasPermi = "service:reply:add")
    @Log(title = "贵宾厅评论回复", businessType = BusinessType.INSERT)
    @PostMapping
    public AjaxResult add(@RequestBody ViphallCommentReply viphallCommentReply)
    {
        return toAjax(viphallCommentReplyService.insertViphallCommentReply(viphallCommentReply));
    }

    /**
     * 修改贵宾厅评论回复
     */
    @PreAuthorize(hasPermi = "service:reply:edit")
    @Log(title = "贵宾厅评论回复", businessType = BusinessType.UPDATE)
    @PutMapping
    public AjaxResult edit(@RequestBody ViphallCommentReply viphallCommentReply)
    {
        return toAjax(viphallCommentReplyService.updateViphallCommentReply(viphallCommentReply));
    }

    /**
     * 删除贵宾厅评论回复
     */
    @PreAuthorize(hasPermi = "service:reply:remove")
    @Log(title = "贵宾厅评论回复", businessType = BusinessType.DELETE)
	@DeleteMapping("/{commentReplyIds}")
    public AjaxResult remove(@PathVariable Long[] commentReplyIds)
    {
        return toAjax(viphallCommentReplyService.deleteViphallCommentReplyByIds(commentReplyIds));
    }
}
